﻿using Microsoft.AspNetCore.Mvc;
using WMS.FC.Application.System.Interface;
using WMS.FC.Domain.DataTransferObject.System;
using WMS.FC.Domain.DomainObject.System;

namespace WMS.FC.WebApi.Controllers
{
    /// <summary>
    /// 分表控制器
    /// </summary>
    public class SplitTableController : BaseConroller
    {
        /// <summary>
        /// 分表服务
        /// </summary>
        protected readonly ISplitTableService splitTableService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="splitTableService"></param>
        public SplitTableController(ISplitTableService splitTableService)
        {
            this.splitTableService = splitTableService;
        }

        /// <summary>
        /// 初始化分表
        /// </summary>
        /// <param name="dTO"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> AddTechnologyRoute(RequestBase dTO)
        {
            var response = await splitTableService.InitializeSplitTable(dTO);
            return Ok(response);
        }

        /// <summary>
        /// 查询分表数据
        /// </summary>
        /// <param name="dTO"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> GetSplitTableData(GetPageDataDTO dTO)
        {
            var response = await splitTableService.GetSplitTableData(dTO);
            return Ok(response);
        }
    }
}
